#include<string>
#include<algorithm>
using namespace std;
class Solution {
public:
    int lengthOfLongestSubstring(string s) {
        int n = s.size(), ret = 0;
        for (int left = 0; left < n; left++)
        {
            int right = left + 1;
            for (; right < n; right++)
            {
                auto it = find(s.begin() + left, s.begin() + right, s[right]);
                if (it == s.begin() + right)
                {
                    ++right;
                }
                else
                {
                    break;
                }
            }
            ret = max(ret, right - left);
        }
        return ret;
    }
};
int main()
{
    string s("au");
    Solution().lengthOfLongestSubstring(s);

    return 0;
}